﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EvectionList.aspx.cs" Inherits="Web.EvectionList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML>
<HEAD>
	<title></title>
    <base target="_self" />
    <meta content="ie=7" http-equiv="x-ua-compatible">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
    <META HTTP-EQUIV="Expires" CONTENT="0">
	<link href="Styles/Style02.css" rel="stylesheet" type="text/css">

    <script src="Scripts/jquery-1.7.min.js" type="text/javascript"></script>
    <link href="Content/scripts/plugIn/Pagination/style.css" rel="stylesheet" type="text/css" />
    <link href="Content/scripts/plugIn/Pagination/core.css" rel="stylesheet" type="text/css" />
    <script src="Content/scripts/plugIn/Pagination/core.js" type="text/javascript"></script>
    <script src="Content/scripts/plugIn/Pagination/pagination.js" type="text/javascript"></script>
	<style>
	    .noDisplay { DISPLAY: none }
	</style>
	<script>
	    //取get参数
	    function getArg() {
	        var url = unescape(window.location.href);
	        var allArgs = url.split("?")[1];
	        if (allArgs != null) {
	            var args = allArgs.split("&");
	            for (var i = 0; i < args.length; i++) {
	                var arg = args[i].split("=");
	                eval('this.' + arg[0] + '="' + arg[1] + '";');
	            }
	        }
	    }
	    var urlArg = new getArg();

	    DWZ.init("Content/scripts/plugIn/Pagination/pagination.xml");
	    $(function () {
	        if (urlArg.numPerPage != undefined) {
	            $("#numPerPage").val(urlArg.numPerPage);
	        }
	        setTimeout(paginationRender, 600);
	    });
	    function paginationRender() {
	        $("div.pagination").each(function () {
	            var $this = $(this);
	            $this.pagination({
	                totalCount: $this.attr("totalCount"),
	                numPerPage: $this.attr("numPerPage"),
	                pageNumShown: $this.attr("pageNumShown"),
	                currentPage: $this.attr("currentPage")
	            });
	        });
	    }
	    function PageBreak(args) {
	        //alert(args["pageNum"] || args["numPerPage"]);
	        if (args["pageNum"] == undefined) { args["pageNum"] = $("li.selected a").text(); }
	        if (args["numPerPage"] == undefined) { args["numPerPage"] = $("#numPerPage").val(); }
	        location.href = "AuditionList.aspx?deptId=" + $("#Dept").val() + "&name=" + escape($("#Name").val()) + "&pageNum=" + args["pageNum"] + "&numPerPage=" + args["numPerPage"];
	    }
	    function add() {
	        var url = 'AuditionAdd.aspx';
	        var retVal = window.showModalDialog(url, window, 'dialogWidth=850px;dialogHeight=550px;status=no;help=no;resizable=yes;');
	        if (retVal != undefined && !isNaN(retVal)) {
	            url = 'AuditionEdit.aspx?id=' + retVal;
	            window.showModalDialog(url, window, 'dialogWidth=850px;dialogHeight=550px;status=no;help=no;');
	            location.reload();
	        }
	    }
	    function view(id) {
	        var url = 'AuditionInfo.aspx?id=' + id;
	        window.showModalDialog(url, window, 'dialogWidth=850px;dialogHeight=550px;status=no;help=no;');
	    }
	    function edit(id) {
	        var url = 'AuditionEdit.aspx?id=' + id;
	        var retVal = window.showModalDialog(url, window, 'dialogWidth=850px;dialogHeight=550px;status=no;help=no;');
	        if (retVal != undefined && !isNaN(retVal)) {
	            location.reload();
	        }
	    }
	    function del(id) {
	        if (confirm('您确定删除该行记录吗?')) {
	            $.ajax({ type: 'post', url: "/Audition.mvc/Delete", data: { id: id },
	                success: function (data, textStatus) {
	                    if (data == "Succeed") { location.href = location.href; }
	                }
	            });
	        }
	    }
    </script>
</HEAD>
<body>
	<form id="Form1" method="post" runat="server">
		<fieldset>
			<legend>查询/新增</legend>
			<table>
				<tr>
					<td><label for="Dept">部门:</label></td>
					<td width=180><select id="Dept" runat="server"></select></td>
                    <td>姓名</td><td width=150><input id="Name" class="textInput" runat="server"></td>
					<td>
                        <a id="A1" class="button" href="javascript:window.close();" runat=server onserverclick="btnSeach_Click"><span>查询</span></a>
                        <a class="buttonActive isDisplay <%= noDisplay%>" href="javascript:add();"><span>新增</span></a>
					</td>
				</tr>
			</table>
		</fieldset>
		<asp:Repeater ID="rptList" EnableViewState="False" Runat="server">
			<HeaderTemplate>
				<table id="tbList" class="s1 list">
					<thead>
						<TR>
							<th width="5%">序号</th>
							<th width="10%">表单编号</th>
							<th width="10%">预计开始时间</th>
							<th width="10%">预计结束时间</th>
							<th width="10%">申请人</th>
							<th width="15%">行程</th>
							<th width="15%">申请原因</th>
							<th width="10%">签核状态</th>
							<th class="tdOrder">操作</th>
						</TR>
					</thead><tbody>
			</HeaderTemplate>
			<ItemTemplate>
				<tr class="<%# Container.ItemIndex%2==0?"bg":""%>">
					<td><%# (Model.CurrentPage-1)*Model.NumPerPage+Container.ItemIndex+1%></td>
					<td><%# DataBinder.Eval(Container.DataItem, "FormNo")%></td>
					<td><%# DataBinder.Eval(Container.DataItem, "PreStartTime", "{0:d}")%></td>
					<td><%# DataBinder.Eval(Container.DataItem, "PreEndTime", "{0:d}")%></td>
					<td><%# DataBinder.Eval(Container.DataItem, "EmpName")%></td>
					<td><%# DataBinder.Eval(Container.DataItem, "Travel")%></td>
					<td><%# DataBinder.Eval(Container.DataItem, "Cause")%></td>
					<td><%# DataBinder.Eval(Container.DataItem, "StatusId")%></td>
					<td>
                        <a href="#" onclick="view(<%# DataBinder.Eval(Container.DataItem,"Id") %>);return false;">[查看]</a>
                        <a href="#" onclick="edit(<%# DataBinder.Eval(Container.DataItem,"Id") %>);return false;" class="<%= noDisplay%>">[编辑]</a>
                        <a href="#" onclick="del(<%# DataBinder.Eval(Container.DataItem,"Id") %>);return false;" class="<%= noDisplay%>">[删除]</a>
                    </td>
				</tr>
			</ItemTemplate>
			<FooterTemplate>
				</tbody> </table>
			</FooterTemplate>
		</asp:Repeater>
	</form>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            <select id="numPerPage" name="numPerPage" onchange="javascript:PageBreak({numPerPage:this.value});" style="width:50px;">
                <option value="10" selected="selected">10</option>
                <option value="15">15</option>
                <option value="20">20</option>
                <option value="30">30</option>
                <option value="50">50</option>
                <option value="100">100</option>
            </select>
            <span>条，共 <%= Model.TotalCount%> 条</span>
        </div>
        <div class="pagination" totalcount="<%= Model.TotalCount%>" numperpage="<%= Model.NumPerPage%>" pagenumshown="<%= Model.PageNumShown%>" currentpage="<%= Model.CurrentPage%>"></div>
    </div>
</body>
</HTML>